home *** CD-ROM | disk | FTP | other *** search
/ PC go! 2008 April / PCgo 2008-04 (DVD).iso / interface / contents / demoversionen_3846 / 13664 / files / Data1.cab / dlgproxy.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2001-10-16  |  3.4 KB  |  95 lines

  1. /******************************************************************/
  2. /*                                                                */
  3. /*                      TurboCAD for Windows                      */
  4. /*                   Copyright (c) 1993 - 2001                    */
  5. /*             International Microcomputer Software, Inc.         */
  6. /*                            (IMSI)                              */
  7. /*                      All rights reserved.                      */
  8. /*                                                                */
  9. /******************************************************************/
  10.  
  11. // DlgProxy.cpp : implementation file
  12. //
  13.  
  14. #include "stdafx.h"
  15. #include "LTSample.h"
  16. #include "DlgProxy.h"
  17. #include "VpWnd.h"
  18. #include "LTSampleDlg.h"
  19.  
  20. #ifdef _DEBUG
  21. #define new DEBUG_NEW
  22. #undef THIS_FILE
  23. static char THIS_FILE[] = __FILE__;
  24. #endif
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CLTSampleDlgAutoProxy
  28.  
  29. IMPLEMENT_DYNCREATE(CLTSampleDlgAutoProxy, CCmdTarget)
  30.  
  31. CLTSampleDlgAutoProxy::CLTSampleDlgAutoProxy()
  32. {
  33.     EnableAutomation();
  34.     
  35.     // To keep the application running as long as an OLE automation 
  36.     //    object is active, the constructor calls AfxOleLockApp.
  37.     AfxOleLockApp();
  38.  
  39.     // Get access to the dialog through the application's
  40.     //  main window pointer.  Set the proxy's internal pointer
  41.     //  to point to the dialog, and set the dialog's back pointer to
  42.     //  this proxy.
  43.     ASSERT (AfxGetApp()->m_pMainWnd != NULL);
  44.     ASSERT_VALID (AfxGetApp()->m_pMainWnd);
  45.     ASSERT_KINDOF(CLTSampleDlg, AfxGetApp()->m_pMainWnd);
  46.     m_pDialog = (CLTSampleDlg*) AfxGetApp()->m_pMainWnd;
  47.     m_pDialog->m_pAutoProxy = this;
  48. }
  49.  
  50. CLTSampleDlgAutoProxy::~CLTSampleDlgAutoProxy()
  51. {
  52.     // To terminate the application when all objects created with
  53.     //     with OLE automation, the destructor calls AfxOleUnlockApp.
  54.     //  Among other things, this will destroy the main dialog
  55.     AfxOleUnlockApp();
  56. }
  57.  
  58. void CLTSampleDlgAutoProxy::OnFinalRelease()
  59. {
  60.     // When the last reference for an automation object is released
  61.     // OnFinalRelease is called.  The base class will automatically
  62.     // deletes the object.  Add additional cleanup required for your
  63.     // object before calling the base class.
  64.  
  65.     CCmdTarget::OnFinalRelease();
  66. }
  67.  
  68. BEGIN_MESSAGE_MAP(CLTSampleDlgAutoProxy, CCmdTarget)
  69.     //{{AFX_MSG_MAP(CLTSampleDlgAutoProxy)
  70.         // NOTE - the ClassWizard will add and remove mapping macros here.
  71.     //}}AFX_MSG_MAP
  72. END_MESSAGE_MAP()
  73.  
  74. BEGIN_DISPATCH_MAP(CLTSampleDlgAutoProxy, CCmdTarget)
  75.     //{{AFX_DISPATCH_MAP(CLTSampleDlgAutoProxy)
  76.         // NOTE - the ClassWizard will add and remove mapping macros here.
  77.     //}}AFX_DISPATCH_MAP
  78. END_DISPATCH_MAP()
  79.  
  80. // Note: we add support for IID_ILTSample to support typesafe binding
  81. //  from VBA.  This IID must match the GUID that is attached to the 
  82. //  dispinterface in the .ODL file.
  83.  
  84. // {31176189-A076-11D1-B79F-000021452DB6}
  85. static const IID IID_ILTSample =
  86. { 0x31176189, 0xa076, 0x11d1, { 0xb7, 0x9f, 0x0, 0x0, 0x21, 0x45, 0x2d, 0xb6 } };
  87.  
  88. BEGIN_INTERFACE_MAP(CLTSampleDlgAutoProxy, CCmdTarget)
  89.     INTERFACE_PART(CLTSampleDlgAutoProxy, IID_ILTSample, Dispatch)
  90. END_INTERFACE_MAP()
  91.  
  92. // The IMPLEMENT_OLECREATE2 macro is defined in StdAfx.h of this project
  93. // {31176187-A076-11D1-B79F-000021452DB6}
  94. IMPLEMENT_OLECREATE2(CLTSampleDlgAutoProxy, "LTSample.Application", 0x31176187, 0xa076, 0x11d1, 0xb7, 0x9f, 0x0, 0x0, 0x21, 0x45, 0x2d, 0xb6)
  95.